﻿using System;
using BusinessLogic.Model;

namespace Admin
{
    public partial class AddNewsItem : System.Web.UI.Page
    {

        #region PageEvents

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        #endregion

        #region ControlEvents

        protected void nieEditor_Save(object sender, EventArgs e)
        {
            NewsItem post = nieEditor.NewsItem;

            using (BlogNETDataContext dc = new BlogNETDataContext())
            {
                dc.NewsItems.InsertOnSubmit(post);
                dc.SubmitChanges();
            }

            Cache.Remove(Constants.Cache.Tags);

            Response.Redirect("~/Main.aspx");
        }

        #endregion

    }
}